//事项提示
$(function(){
    $(".fixnews .title span").click(function(){
        $(this).parents(".fixnews").toggleClass(    "fixnews_down");
    });
});
var resultss=""
/*updataOrderNum();*/
function updataOrderNum() {
    monitoringEvents=2
    $.ajax({
        url: root.accessInter.queryTipsNum,
        cache: false,  //禁用缓存
        type: "POST",
        dataType:'json',
        contentType: "application/json",
        data: JSON.stringify({
            org_warehouse_id:sessionStorage.getItem("organizationWarehouse"),//公司对应的发货仓id
            warehouse_ids:sessionStorage.getItem("regions"),//仓库权限串
            belong_groupIds:sessionStorage.getItem("companys"),//销售归属权限串
            sales_manager_ids:sessionStorage.getItem("personnels"),//销售经理权限串
            member_id:JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.user_ID,
        }),
        success: function (result) {
            resultss=result
            if(result.errorCode==0){
                if(result.data.normal_customer_certify_num!=null && result.data.normal_customer_certify_num!=""&& result.data.normal_customer_certify_num!='0'){
                    $("#a").html(result.data.normal_customer_certify_num)
                }else {
                    $("#a").html('<a style="color: #9c9a9a">0</a>')
                }
                /*if(result.data.cs_box_num!=null && result.data.cs_box_num!=""&& result.data.cs_box_num!='0'){
                    $("#b").html(result.data.cs_box_num)
                }else {
                    $("#b").html('<a style="color: #9c9a9a">0</a>')
                }*/
                if(result.data.anomal_order_num!=null && result.data.anomal_order_num!=""&& result.data.anomal_order_num!='0'){
                    $("#c").html(result.data.anomal_order_num)
                }else {
                    $("#c").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.inquiry_unmatch_num!=null && result.data.inquiry_unmatch_num!=""&& result.data.inquiry_unmatch_num!="0"){
                    $("#d").html(result.data.inquiry_unmatch_num)
                }else {
                    $("#d").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.inquiry_unpriced_num!=null && result.data.inquiry_unpriced_num!=""&& result.data.inquiry_unpriced_num!="0"){
                    $("#e").html(result.data.inquiry_unpriced_num)
                }else {
                    $("#e").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.vairable_price_order_num!=null && result.data.vairable_price_order_num!=""&& result.data.vairable_price_order_num!="0"){
                    $("#f").html(result.data.vairable_price_order_num)
                }else {
                    $("#f").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.docking_inquiry_unmatch_num!=null && result.data.docking_inquiry_unmatch_num!=""&& result.data.docking_inquiry_unmatch_num!="0"){
                    $("#g").html(result.data.docking_inquiry_unmatch_num)
                }else {
                    $("#g").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.docking_inquiry_unpriced_num!=null && result.data.docking_inquiry_unpriced_num!=""&& result.data.docking_inquiry_unpriced_num!="0"){
                    $("#h").html(result.data.docking_inquiry_unpriced_num)
                }else {
                    $("#h").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.undeal_cancleApply_order_num!=null && result.data.undeal_cancleApply_order_num!=""&& result.data.undeal_cancleApply_order_num!="0"){
                    $("#cc").html(result.data.undeal_cancleApply_order_num)
                }else {
                    $("#cc").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.dealing_cancleApply_order_num!=null && result.data.dealing_cancleApply_order_num!=""&& result.data.dealing_cancleApply_order_num!="0"){
                    $("#hh").html(result.data.dealing_cancleApply_order_num)
                }else {
                    $("#hh").html('<a style="color: #9c9a9a">0</a>')
                }

                if(result.data.uninvoiced_order_num!=null && result.data.uninvoiced_order_num!=""&& result.data.uninvoiced_order_num!="0"){
                    $("#i").html(result.data.uninvoiced_order_num)
                }else {
                    $("#i").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.unaudit_refund_num!=null && result.data.unaudit_refund_num!=""&& result.data.unaudit_refund_num!="0"){
                    $("#j").html(result.data.unaudit_refund_num)
                }else {
                    $("#j").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.unaudit_maintain_num!=null && result.data.unaudit_maintain_num!=""&& result.data.unaudit_maintain_num!="0"){
                    $("#k").html(result.data.unaudit_maintain_num)
                }else {
                    $("#k").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.unaudit_coupon_num!=null && result.data.unaudit_coupon_num!=""&& result.data.unaudit_coupon_num!="0"){
                    $("#l").html(result.data.unaudit_coupon_num)
                }else {
                    $("#l").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.undeal_cooperate_num!=null && result.data.undeal_cooperate_num!=""&& result.data.undeal_cooperate_num!="0"){
                    $("#m").html(result.data.undeal_cooperate_num)
                }else {
                    $("#m").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.dealing_cooperate_num!=null && result.data.dealing_cooperate_num!=""&& result.data.dealing_cooperate_num!="0"){
                    $("#n").html(result.data.dealing_cooperate_num)
                }else {
                    $("#n").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.ungenerate_preorder_num !=null && result.data.ungenerate_preorder_num !=""&& result.data.ungenerate_preorder_num !="0"){
                    $("#o").html(result.data.ungenerate_preorder_num )
                }else {
                    $("#o").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.unreply_comments !=null && result.data.unreply_comments !=""&& result.data.unreply_comments !="0"){
                    $("#p").html(result.data.unreply_comments)
                }else {
                    $("#p").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.docking_anomal_order_num !=null && result.data.docking_anomal_order_num !=""&& result.data.docking_anomal_order_num !="0"){
                    $("#s").html(result.data.docking_anomal_order_num)
                }else {
                    $("#s").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.docking_undeal_cancleApply_order_num !=null && result.data.docking_undeal_cancleApply_order_num !=""&& result.data.docking_undeal_cancleApply_order_num !="0"){
                    $("#t").html(result.data.docking_undeal_cancleApply_order_num)
                }else {
                    $("#t").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.docking_dealing_cancleApply_order_num !=null && result.data.docking_dealing_cancleApply_order_num !=""&& result.data.docking_dealing_cancleApply_order_num !="0"){
                    $("#u").html(result.data.docking_dealing_cancleApply_order_num)
                }else {
                    $("#u").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.docking_uninvoiced_order_num !=null && result.data.docking_uninvoiced_order_num !=""&& result.data.docking_uninvoiced_order_num !="0"){
                    $("#v").html(result.data.docking_uninvoiced_order_num)
                }else {
                    $("#v").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.docking_unaudit_refund_num !=null && result.data.docking_unaudit_refund_num !=""&& result.data.docking_unaudit_refund_num !="0"){
                    $("#w").html(result.data.docking_unaudit_refund_num)
                }else {
                    $("#w").html('<a style="color: #9c9a9a">0</a>')
                }
                if(result.data.docking_unaudit_maintain_num !=null && result.data.docking_unaudit_maintain_num !=""&& result.data.docking_unaudit_maintain_num !="0"){
                    $("#x").html(result.data.docking_unaudit_maintain_num)
                }else {
                    $("#x").html('<a style="color: #9c9a9a">0</a>')
                }
                //订单预警管理
                if(result.data.distribution_order_warning_num !=null && result.data.distribution_order_warning_num !=""&& result.data.distribution_order_warning_num !="0"){
                    $("#yuncaiDistribution").html(result.data.distribution_order_warning_num)
                }else {
                    $("#yuncaiDistribution").html('<a style="color: #9c9a9a">0</a>')
                }
        
                if(result.data.docking_order_warning_num !=null && result.data.docking_order_warning_num !=""&& result.data.docking_order_warning_num !="0"){
                    $("#dockingDistribution").html(result.data.docking_order_warning_num)
                }else {
                    $("#dockingDistribution").html('<a style="color: #9c9a9a">0</a>')
                }

                //积分订单
                if(result.data.integral_order_pending_num !=null && result.data.integral_order_pending_num !=""&& result.data.integral_order_pending_num !="0"){
                    $("#numberofpoints").html(result.data.integral_order_pending_num)
                }else {
                    $("#numberofpoints").html('<a style="color: #9c9a9a">0</a>')
                }

                //账号对接失败
                if(result.data.userSyncErrorNum){
                    $("#accountFailedNum").html(result.data.userSyncErrorNum);
                }else {
                    $("#accountFailedNum").html('<a style="color: #9c9a9a">0</a>');
                }

                //AIC
                if(result.data.undeal_aic_cooperate_num !=null && result.data.undeal_aic_cooperate_num !=""&& result.data.undeal_aic_cooperate_num !="0"){
                    $("#aic").html(result.data.undeal_aic_cooperate_num)
                }else {
                    $("#aic").html('<a style="color: #9c9a9a">0</a>')
                }
                //客户管理
                if(result.data.transfer_customer_num!=null && result.data.transfer_customer_num!=""&& result.data.transfer_customer_num!='0'){
                    $("#customerNumber").html(result.data.transfer_customer_num)
                }else {
                    $("#customerNumber").html('<a style="color: #9c9a9a">0</a>')
                }
            }
            if(result.data==null){
                $("#a").html('<a style="color: #9c9a9a">0</a>')
                $("#c").html('<a style="color: #9c9a9a">0</a>')
                $("#d").html('<a style="color: #9c9a9a">0</a>')
                $("#e").html('<a style="color: #9c9a9a">0</a>')
                $("#f").html('<a style="color: #9c9a9a">0</a>')
                $("#g").html('<a style="color: #9c9a9a">0</a>')
                $("#h").html('<a style="color: #9c9a9a">0</a>')
                $("#i").html('<a style="color: #9c9a9a">0</a>')
                $("#j").html('<a style="color: #9c9a9a">0</a>')
                $("#k").html('<a style="color: #9c9a9a">0</a>')
                $("#l").html('<a style="color: #9c9a9a">0</a>')
                $("#m").html('<a style="color: #9c9a9a">0</a>')
                $("#n").html('<a style="color: #9c9a9a">0</a>')
                $("#o").html('<a style="color: #9c9a9a">0</a>')
                $("#p").html('<a style="color: #9c9a9a">0</a>')
                $("#t").html('<a style="color: #9c9a9a">0</a>')
                $("#u").html('<a style="color: #9c9a9a">0</a>')
                $("#v").html('<a style="color: #9c9a9a">0</a>')
                $("#w").html('<a style="color: #9c9a9a">0</a>')
                $("#x").html('<a style="color: #9c9a9a">0</a>')
                $("#s").html('<a style="color: #9c9a9a">0</a>')
                $("#cc").html('<a style="color: #9c9a9a">0</a>')
                $("#hh").html('<a style="color: #9c9a9a">0</a>')
                $("#yuncaiDistribution").html('<a style="color: #9c9a9a">0</a>')
                $("#dockingDistribution").html('<a style="color: #9c9a9a">0</a>')
                $("#numberofpoints").html('<a style="color: #9c9a9a">0</a>')
                $("#aic").html('<a style="color: #9c9a9a">0</a>');
                $("#accountFailedNum").html('<a style="color: #9c9a9a">0</a>');
                $("#customerNumber").html('<a style="color: #9c9a9a">0</a>')

            }
        },

    });
}
//一进入页面时只执行一次
$(function () {
    var num=0;
    var times=null
    if(times!=null){
        clearTimeout(times)
    }
    times=setTimeout(function () {
        num++;
        updataOrderNum()
    },1000)
})
setInterval("updataOrderNum()",1000*60*5);//5秒调用一次

/*跳转订单详情*/
function tank(val){
    if(val==1){
        if(resultss.data.normal_customer_certify_num!=null && resultss.data.normal_customer_certify_num!=""&& resultss.data.normal_customer_certify_num!='0'){
            sessionStorage.setItem("examstatus",'10')
            $(window.parent.document).find("#member")[0].click();
            $(window.parent.document).find("#reviewUpgrade")[0].click();
        }else {

        }

    }else if(val==2){
        if(resultss.data.anomal_order_num!=null && resultss.data.anomal_order_num!=""&& resultss.data.anomal_order_num!='0') {
            sessionStorage.setItem("abstatus",'10')
            $(window.parent.document).find("#order")[0].click();
            $(window.parent.document).find("#abnormalOrder")[0].click();
        }else {

        }
    }else if(val==3){
        if(resultss.data.inquiry_unmatch_num!=null && resultss.data.inquiry_unmatch_num!=""&& resultss.data.inquiry_unmatch_num!="0") {
            sessionStorage.setItem("Instatus1",'1020')
            $(window.parent.document).find("#order")[0].click();
            $(window.parent.document).find("#InquiryListManage")[0].click();
        }else {

        }

    }else if(val==4){
        if(resultss.data.inquiry_unpriced_num!=null && resultss.data.inquiry_unpriced_num!=""&& resultss.data.inquiry_unpriced_num!="0"){
            sessionStorage.setItem("Instatus2",'3040')
            $(window.parent.document).find("#order")[0].click();
            $(window.parent.document).find("#InquiryListManage")[0].click();

        }else {

        }

    }else if(val==5){
        if(resultss.data.vairable_price_order_num!=null && resultss.data.vairable_price_order_num!=""&& resultss.data.vairable_price_order_num!="0") {
            sessionStorage.setItem("changetatus",'10')
            $(window.parent.document).find("#order")[0].click();
            $(window.parent.document).find("#orderChange")[0].click();

        }else {

        }

    }else if(val==6){
        if(resultss.data.undeal_cancleApply_order_num!=null && resultss.data.undeal_cancleApply_order_num!=""&& resultss.data.undeal_cancleApply_order_num!="0") {
            sessionStorage.setItem("dealstatus1",'10')
            $(window.parent.document).find("#order")[0].click();
            $(window.parent.document).find("#cancelOrder")[0].click();
        }else {

        }



    }else if(val==7){
        if(resultss.data.dealing_cancleApply_order_num!=null && resultss.data.dealing_cancleApply_order_num!=""&& resultss.data.dealing_cancleApply_order_num!="0") {
            sessionStorage.setItem("dealstatus2",'20')
            $(window.parent.document).find("#order")[0].click();
            $(window.parent.document).find("#cancelOrder")[0].click();
        }else {

        }

    }else if(val==8){
        if(resultss.data.uninvoiced_order_num!=null && resultss.data.uninvoiced_order_num!=""&& resultss.data.uninvoiced_order_num!="0") {
            sessionStorage.setItem("invoicestatus",'10')
            sessionStorage.setItem("orderSource",'10,20')
            $(window.parent.document).find("#invoice")[0].click();
            $(window.parent.document).find("#invoiceRefill")[0].click();
        }else {

        }


    }else if(val==9){
        if(resultss.data.unaudit_refund_num!=null && resultss.data.unaudit_refund_num!=""&& resultss.data.unaudit_refund_num!="0") {
            sessionStorage.setItem("returnstatus",'10')
            $(window.parent.document).find("#sale")[0].click();
            $(window.parent.document).find("#return")[0].click();
        }else {

        }



    }else if(val==10){
        if(resultss.data.unaudit_maintain_num!=null && resultss.data.unaudit_maintain_num!=""&& resultss.data.unaudit_maintain_num!="0") {

            sessionStorage.setItem("maintainstatus",'10')
            $(window.parent.document).find("#sale")[0].click();
            $(window.parent.document).find("#maintain")[0].click();

        }else {

        }

    }else if(val==11){
        if(resultss.data.unaudit_coupon_num!=null && resultss.data.unaudit_coupon_num!=""&& resultss.data.unaudit_coupon_num!="0") {
            sessionStorage.setItem("coupon",'10')
            $(window.parent.document).find("#electronic")[0].click();
            $(window.parent.document).find("#check")[0].click();
        }else {

        }



    }else if(val==12){
        if(resultss.data.undeal_cooperate_num!=null && resultss.data.undeal_cooperate_num!=""&& resultss.data.undeal_cooperate_num!="0") {
            sessionStorage.setItem("cooperstate1",'10')
            sessionStorage.setItem("coopertype",'')
            $(window.parent.document).find("#cooperation")[0].click();
            $(window.parent.document).find("#operate")[0].click();
        }else {

        }


    }else if(val==13){
        if(resultss.data.unreply_comments !=null && resultss.data.unreply_comments !=""&& resultss.data.unreply_comments !="0"){
            sessionStorage.setItem("customerFeedbackstatus",'10')
            $(window.parent.document).find("#operatemanagement")[0].click();
            $(window.parent.document).find("#kehu")[0].click();
        }else {

        }

    }else if(val==14){
        if(resultss.data.ungenerate_preorder_num !=null && resultss.data.ungenerate_preorder_num !=""&& resultss.data.ungenerate_preorder_num !="0"){
            //sessionStorage.setItem("cooperstate2",'20')
            $(window.parent.document).find("#duijieorder")[0].click();
            $(window.parent.document).find("#orderNum")[0].click();
        }else {

        }

    }else if(val==15){
        if(resultss.data.docking_inquiry_unmatch_num !=null && resultss.data.docking_inquiry_unmatch_num !=""&& resultss.data.docking_inquiry_unmatch_num !="0"){
            sessionStorage.setItem("Instatus1",'1020');
            $(window.parent.document).find("#duijieorder")[0].click();
            $(window.parent.document).find("#inqueryOrderNum")[0].click();
        }else {

        }

    }else if(val==16){
        if(resultss.data.docking_inquiry_unpriced_num !=null && resultss.data.docking_inquiry_unpriced_num !=""&& resultss.data.docking_inquiry_unpriced_num !="0"){
            sessionStorage.setItem("Instatus2",'3040');
            $(window.parent.document).find("#duijieorder")[0].click();
            $(window.parent.document).find("#inqueryOrderNum")[0].click();
        }else {

        }

    }else if(val==17){
        if(resultss.data.docking_anomal_order_num !=null && resultss.data.docking_anomal_order_num !=""&& resultss.data.docking_anomal_order_num !="0"){
            sessionStorage.setItem("examstatus",'1')
            $(window.parent.document).find("#duijieorder")[0].click();
            $(window.parent.document).find("#dingdan")[0].click();
        }else {

        }

    }else if(val==18){
        if(resultss.data.docking_undeal_cancleApply_order_num !=null && resultss.data.docking_undeal_cancleApply_order_num !=""&& resultss.data.docking_undeal_cancleApply_order_num !="0"){
            sessionStorage.setItem("dealstatus1",'10');
            $(window.parent.document).find("#duijieorder")[0].click();
            $(window.parent.document).find("#quxiao")[0].click();
        }else {

        }

    }else if(val==19){
        if(resultss.data.docking_dealing_cancleApply_order_num !=null && resultss.data.docking_dealing_cancleApply_order_num !=""&& resultss.data.docking_dealing_cancleApply_order_num !="0"){
            sessionStorage.setItem("dealstatus2",'20')
            $(window.parent.document).find("#duijieorder")[0].click();
            $(window.parent.document).find("#quxiao")[0].click();
        }else {

        }

    }else if(val==20){
        if(resultss.data.docking_unaudit_refund_num !=null && resultss.data.docking_unaudit_refund_num !=""&& resultss.data.docking_unaudit_refund_num !="0"){
            sessionStorage.setItem("returnstatus",'10');
            $(window.parent.document).find("#shouhou")[0].click();
            $(window.parent.document).find("#tuihuo")[0].click();
        }else {

        }

    }else if(val==21){
        if(resultss.data.docking_unaudit_maintain_num !=null && resultss.data.docking_unaudit_maintain_num !=""&& resultss.data.docking_unaudit_maintain_num !="0"){
            sessionStorage.setItem("maintainstatus",'10');
            $(window.parent.document).find("#shouhou")[0].click();
            $(window.parent.document).find("#weixiu")[0].click();
        }else {

        }

    }else if(val==22){
        if(resultss.data.docking_uninvoiced_order_num !=null && resultss.data.docking_uninvoiced_order_num !=""&& resultss.data.docking_uninvoiced_order_num !="0") {
            sessionStorage.setItem("invoicestatus",'10')
            sessionStorage.setItem("orderSource",'40')
            $(window.parent.document).find("#invoice")[0].click();
            $(window.parent.document).find("#invoiceRefill")[0].click();
        }else {

        }
    }else if(val==23){
        if(resultss.data.distribution_order_warning_num !=null && resultss.data.distribution_order_warning_num !=""&& resultss.data.distribution_order_warning_num !="0"){
            sessionStorage.setItem("earlyWarning_source",'10,20');//订单来源
            sessionStorage.setItem("earlyWarning_distinguish",'1');//区分
            $(window.parent.document).find("#order")[0].click();
            $(window.parent.document).find("#earlyWarning")[0].click();
        }else {

        }

    }else if(val==25){
        if(resultss.data.docking_order_warning_num !=null && resultss.data.docking_order_warning_num !=""&& resultss.data.docking_order_warning_num !="0"){
            sessionStorage.setItem("earlyWarning_source",'40');//订单来源
            sessionStorage.setItem("earlyWarning_distinguish",'3');//区分
            $(window.parent.document).find("#order")[0].click();
            $(window.parent.document).find("#earlyWarning")[0].click();
        }else {

        }

    }else if(val==26){
        if(resultss.data.integral_order_pending_num !=null && resultss.data.integral_order_pending_num !=""&& resultss.data.integral_order_pending_num !="0") {
            sessionStorage.setItem("integralchange_price",'50')
            $(window.parent.document).find("#integralManagement")[0].click();
            $(window.parent.document).find("#integralOrder")[0].click();
        }else {

        }


    }else if(val==27){
        if(resultss.data.undeal_aic_cooperate_num !=null && resultss.data.undeal_aic_cooperate_num !=""&& resultss.data.undeal_aic_cooperate_num !="0") {
            sessionStorage.setItem("coopertype",'4')
            sessionStorage.setItem("cooperstate1",'10')
            $(window.parent.document).find("#cooperation")[0].click();
            $(window.parent.document).find("#operate")[0].click();
        }else {

        }



    }else if(val == 28){
        if(resultss.data.normal_customer_certify_num!=null && resultss.data.normal_customer_certify_num!=""&& resultss.data.normal_customer_certify_num!='0'){
            sessionStorage.setItem("examstatus",'10')
            $(window.parent.document).find("#member")[0].click();
            $(window.parent.document).find("#ErrorSigning")[0].click();
        }else {

        }
    }else  if(val==29){
        if(resultss.data.transfer_customer_num!=null && resultss.data.transfer_customer_num!=""&& resultss.data.transfer_customer_num!='0'){
            sessionStorage.setItem("customerisEnter",'30')
            sessionStorage.setItem("customerGrades",'S级,A级,B级,C级')
            $(window.parent.document).find("#customermanagement")[0].click();
            $(window.parent.document).find("#customerpools")[0].click();
        }else {

        }


    }
}